<?php

namespace common\entities\common;

use common\entities\ConfigEntity;
use Yii;

/**
 * This is the model class for table "myscrm_database_instance_config".
 * @property string $id
 * @property string $name
 * @property string $instance_id
 * @property string $description
 * @property string $host
 * @property string $port
 * @property string $username
 * @property string $password
 * @property string $status
 * @property string $admin_name
 * @property string $admin_password
 */
class MyscrmDatabaseInstanceConfigEntity extends ConfigEntity
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_database_instance_config';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'name', 'instance_id', 'host', 'port'], 'required'],
            [['id'], 'string', 'max' => 36],
            [['name', 'host', 'username', 'password'], 'string', 'max' => 255],
            [['instance_id', 'port', 'status'], 'string', 'max' => 45],
            [['description'], 'string', 'max' => 1024],
            [['host'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id'          => '数据库实例ID',
            'name'        => 'DB实例名称',
            'instance_id' => '阿里云的实例ID',
            'description' => '描述',
            'host'        => '主机地址',
            'port'        => '端口',
            'username'    => '用户名',
            'password'    => '密码',
            'status'      => '状态 enable:启用 disable:禁用',
        ];
    }
}
